{template common/header}
{template user/userheader}
<div class="container mt20">
	<div class="span12 main">
		{template user/usernav}
		<div class="messages">
			<h4 class="mt10 text_c">
			{lang tip_edit_topic}
			</h4>
         <form id="update_topic_form" class="form-horizontal mt10" method="post"  action="{url home/updatetopic}">
         	<fieldset>
         		<input type="hidden" name="submit" value="true"/>
         		<input type="hidden" name="topicid" value="$topic['topic_id']"/>
         		<input type="hidden" name="bannerchanged" id="bannerchanged" value="no"/>
					<div class="control-group">
			            <label class="control-label">{lang label_image_settings}</label>
			            <div class="controls" id="cropbannerimg">
         					<input type="hidden" name="cover"/>
							<button type="button" class="btn" data-action="openBanner" data-params="topic,$topic['topic_id']">{lang label_set_banner}</button>
							<img class="image-bg" src="{echo topicbanner($topic['topic_id'])}" onerror="javascript:this.src='{baseurl}assets/img/default_topic_banner.jpg';" id="banner_topic_$topic['topic_id']" height="30">
							<p class="help-block">{lang tip_open_new_win}</p>
			            </div>
			        </div>
					<div class="control-group">
			            <label class="control-label" for="topic_title">{lang topic_title}</label>
			            <div class="controls">
			                <input id="topic_title" type="text" name="topic_title" value="$topic['topic_title']"/>
			            </div>
			        </div>
			        <div class="control-group">
			            <label class="control-label" for="category_id">{lang category}</label>
			            <div class="controls">
			            	<select id="category_id" name="category_id" class="span3">
			            	{loop $rootCategories $category}
			            		<option value="$category['category_id']" {if $category['category_id']==$topic['category_id']}selected{/if}>$category['category_name_cn']</option>
			            	{/loop}
			            	</select>
			            </div>
			        </div>
					<div class="control-group">
			            <label class="control-label" for="topic_desc">{lang topic_desc}</label>
			            <div class="controls">
			            	<textarea id="topic_desc" name="topic_desc" rows="6" class="span4">$topic['topic_desc']</textarea>
			            </div>
			        </div>
			        
					<div class="control-group">
			            <label class="control-label" for="keyword">{lang tag}</label>
			            <div class="controls">
			            	<input id="keyword" type="text" name="keyword" value="$topic['keyword']"/>
							<p class="help-block">{lang tag_tip}</p>
			            </div>
			        </div>
			        <div class="control-group">
			        	<label class="control-label"></label>
			            <div class="controls">
			            <button type="submit" class="btn btn-primary submit-btn" data-loading-text="{lang tip_loading}">{lang save}</button>
			            </div>
			        </div>
         	</fieldset>
    	</form>
       </div>
	</div>
</div>
<script>
$(document).ready(function() {
	$.oValidate('update_topic_form');
});
</script>
{template common/footer}
